package com.sharemarking.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sharemarking.system.dto.agreement.AgreementListDto;
import com.sharemarking.wa.common.entity.Agreement;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author dxy
 */
@Repository
public interface AgreementMapper extends BaseMapper<Agreement> {
    @Update("UPDATE wa_agreement SET update_date=#{updateDate}, name=#{name}, expire_date=#{expireDate}, pics=#{pics} WHERE id=#{id} ")
    void update(Agreement agreement);

    List<AgreementListDto> getList(Map map);

    Integer getListTotal(Map map);

    @Select("SELECT * FROM wa_agreement WHERE org_id = #{orgId}")
    List<AgreementListDto> getListByOrgId(Integer orgId);

    @Update("UPDATE wa_agreement SET exam_state = #{state} WHERE org_id = #{orgId}")
    void updateExamState(@Param("orgId") Integer orgId, @Param("state")Integer state);
}
